package com.shopping.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.shopping.model.Admins;
import com.shopping.model.Goods;
import com.shopping.model.Items;
import com.shopping.model.Orders;
import com.shopping.model.Types;
import com.shopping.model.Users;

public interface AdminDao {
	
    /**
     * 分页查询订单
     */
	@Select("<script>select * from orders <where>"
			+"<if test='status>0'> and status=#{status}</if>"
			+ "</where> limit #{start}, #{size}</script>")
	List<Orders> orderList(@Param("status") byte status, @Param("start") int start, @Param("size") int size);
	
	@Select("select * from items where order_id = #{orderId}")
	List<Items> getItemsByOrderId(@Param("orderId") int orderId);
	
	@Select("select * from goods where id = #{id}")
	Goods getByIdGoods(int id);
	
	@Select("select * from users where id = #{userId}")
	Users getByIdUser(int userId);
	
	@Select("<script>select count(*) from orders <where><if test='status>0'> and status=status</if></where></script>")
	long getCountsByStatus(@Param("status") byte status);
}
